package com.by.controller;

import com.by.bean.GoodsCategory;
import com.by.common.core.bean.ResultBean;
import com.by.common.core.controller.BaseController;
import com.by.service.GoodsCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/goodscategory")
@Api(tags = "商品类型")
public class GoodsCategoryController extends BaseController {

    @Autowired
    GoodsCategoryService goodsCategoryService;

    @GetMapping("/tree")
    @ApiOperation("商品分类类别树")
    public ResultBean goodsCategoryTree(){
        List<GoodsCategory> categorytree = goodsCategoryService.categorytree();
        return success("类别树",categorytree);
    }
}
